import moment from "moment";
import {Fragment} from "react";
import {Divider, Icon, Popconfirm} from "antd";
import React from "react";

export const activeColumns= [
  {
    title: '序号Id',
    dataIndex: 'categoryId',
  },
  {
    title: '活动标题',
    dataIndex: 'title',
  },
  {
    title: '分类',
    // dataIndex: 'status',
    dataIndex: "categorys"
  },
  {
    title: '主讲人',
    // dataIndex: 'status',
    dataIndex: "state"
  },
  {
    title: '地点',
    // dataIndex: 'status',
    dataIndex: "state"
  },
  {
    title: '报名人数',
    // dataIndex: 'status',
    dataIndex: "state"
  },
  {
    title: '未支付成功数',
    // dataIndex: 'status',
    dataIndex: "state"
  },
  {
    title: '阅读数',
    // dataIndex: 'status',
    dataIndex: "state"
  },
  {
    title: '评论数',
    // dataIndex: 'status',
    dataIndex: "state"
  },
  {
    title: '收藏数',
    // dataIndex: 'status',
    dataIndex: "state"
  },
  {
    title: '喜欢数',
    // dataIndex: 'status',
    dataIndex: "state"
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    sorter: (a, b) => Date.parse(a.createTime) > Date.parse(b.createTime),
    render: val => <span>{moment(val).format('YYYY-MM-DD HH:mm:ss')}</span>,
  },
  {
    title: '发布时间',
    dataIndex: 'updateTime',
    sorter: (a, b) => Date.parse(a.updateTime) > Date.parse(b.updateTime),
    render: val => <span>{moment(val).format('YYYY-MM-DD HH:mm:ss')}</span>,
  },
  {
    title: '类型type',
    // dataIndex: 'status',
    dataIndex: "state"
  },
  {
    title: '状态category',
    // dataIndex: 'status',
    dataIndex: "state"
  },
  {
    title: '操作',
    render: (text, item) => (
      <Fragment>
        <a onClick={() => this.handleModalVisible(true, item)}>修改</a>
        <Divider type="vertical"/>
        <Popconfirm onConfirm={() => this.cateogryDelete(item.categoryId)} title="确定删除该类别吗？"
                    icon={<Icon type="question-circle-o" style={{color: 'red'}}/>}>
          <a><Icon type="delete" style={{marginRight: 8}}/>删除</a>
        </Popconfirm>
        <Divider type="vertical"/>
        <a onClick={() => this.handleModalVisible(true, item)}>详情</a>
      </Fragment>
    ),
  },
];
